/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Home-pc
 * Date: 2023-09-17
 * Time: 14:20
 */
class MyRunnable implements Runnable{
//
    @Override
    public void run() {
        while(true){
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            System.out.println("这里是线程1");
        }
    }
}
public class Demo2 {
    public static void main(String[] args) throws InterruptedException {
        MyRunnable myRunnable=new MyRunnable();
        Thread  t = new Thread(myRunnable);
        t.start();
        while(true){
            Thread.sleep(1000);
            System.out.println("这里是主线程");
        }
    }
}
